package com.imooc.controller;

import com.imooc.enums.ErrorMsg;
import com.imooc.enums.OrderStatusEnum;
import com.imooc.pojo.UserAddress;
import com.imooc.pojo.bo.AddressBO;
import com.imooc.pojo.bo.SubmitOrderBO;
import com.imooc.service.AddressService;
import com.imooc.service.OrdersService;
import com.imooc.utils.CommonJsonResult;
import com.imooc.utils.MobileEmailUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 * @author 逸尘风清
 * @date 2021/5/10
 * @time 9:55
 * 描述：
 */
@Api(value = "订单接口" , tags = {"订单相关接口"})
@RestController
@RequestMapping("/orders")
public class OrdersController {
    @Resource
    private OrdersService ordersService;

    @ApiOperation(value = "创建订单", notes = "创建订单", httpMethod = "POST")
    @PostMapping("create")
    public CommonJsonResult create(
            @ApiParam(value = "用户提交实体类", required = true)
            @RequestBody SubmitOrderBO submitOrderBO)
    {

        String orderId = ordersService.createOrder(submitOrderBO);

        return CommonJsonResult.ok(orderId);
    }
}
